package com.hjw.oop;

/**
 * 游园工具类
 * @author hjwStrart
 * @create 2022-01-07 14:23
 */
public class ParkUtils {
    private double price = 150;

    /**
     * 根据游客年龄   计算游客票价
     * @param jourist
     */
    public void calculatePrice(Jourist jourist){
        Integer age = jourist.getAge();
        if (age < 12){
            System.out.println(jourist.getName() + "的门票是：" + price*0 + "元");

        }else if( age < 16){
            System.out.println(jourist.getName() + "的门票是：" + price*0.6 + "元");

        }else if( age < 60){
            System.out.println(jourist.getName() + "的门票是：" + price + "元");

        }else{
            System.out.println(jourist.getName() + "的门票是：" + price*0.5 + "元");

        }
    }
}
